Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Team Project Access API #599

Merged
merged 7 commits into from
Jan 5, 2023
Merged

Conversation

hs26gill
Copy link
Contributor

@hs26gill hs26gill commented Nov 30, 2022

Description

A new Team Project Access API is added to allow users to associate team permissions on a project. Projects Team Access API docs are here (wip branch: https://github.com/hashicorp/terraform-docs-common/blob/54874464fc887ba6c3c2cae7839db9779351733d/website/docs/cloud-docs/api-docs/project-team-access.mdx)

Testing plan

To run the integration test:

ENABLE_BETA=1 go test -run TestTeamProjectAccessRead  -v ./... -tags=integration

ENABLE_BETA=1 go test -run TestTeamProjectAccessAdd  -v ./... -tags=integration

ENABLE_BETA=1 go test -run TestTeamProjectAccessUpdate -v ./... -tags=integration

ENABLE_BETA=1 go test -run TestTeamProjectAccessRemove  -v ./... -tags=integration

ENABLE_BETA=1 go test -run TestTeamProjectAccessList  -v ./... -tags=integration

@hs26gill hs26gill requested a review from a team as a code owner November 30, 2022 22:02
@hs26gill hs26gill force-pushed the hs26gill/add-team-project-permissions branch from a0d6234 to 0a7d64c Compare November 30, 2022 22:03
mwudka
mwudka previously approved these changes Nov 30, 2022
Copy link
Contributor

@mwudka mwudka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay, permissions!

@hs26gill hs26gill changed the title Added team project access resource and tests Added Team Project Access API Dec 2, 2022
@hs26gill hs26gill force-pushed the hs26gill/add-team-project-permissions branch 2 times, most recently from 195854e to 58c0687 Compare December 5, 2022 19:32
@hs26gill hs26gill force-pushed the hs26gill/add-team-project-permissions branch from 58c0687 to d51eb04 Compare December 14, 2022 17:59
Copy link
Collaborator

@brandonc brandonc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not run the tests or smoke test in some other way, but the code looks very conventional with a small exception for pointer types on the Add method.

annawinkler
annawinkler previously approved these changes Dec 15, 2022
Copy link
Contributor

@annawinkler annawinkler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran tests locally and things look good:

go-tfe[hs26gill/add-team-project-permissions*] % envchain tfe-local go test -run TestTeamProjectAccess -v ./... -tags=integration
=== RUN   TestTeamProjectAccessesList
Connecting to https://tfcdev-f0bcf9e5.ngrok.io/api/v2/=== RUN   TestTeamProjectAccessesList/with_valid_options
=== RUN   TestTeamProjectAccessesList/with_list_options
=== RUN   TestTeamProjectAccessesList/without_TeamProjectAccessListOptions
=== RUN   TestTeamProjectAccessesList/without_projectID_options
=== RUN   TestTeamProjectAccessesList/without_a_valid_projectID
--- PASS: TestTeamProjectAccessesList (11.08s)
    --- PASS: TestTeamProjectAccessesList/with_valid_options (0.31s)
    --- PASS: TestTeamProjectAccessesList/with_list_options (0.31s)
    --- PASS: TestTeamProjectAccessesList/without_TeamProjectAccessListOptions (0.00s)
    --- PASS: TestTeamProjectAccessesList/without_projectID_options (0.00s)
    --- PASS: TestTeamProjectAccessesList/without_a_valid_projectID (0.00s)
=== RUN   TestTeamProjectAccessesRead
Connecting to https://tfcdev-f0bcf9e5.ngrok.io/api/v2/=== RUN   TestTeamProjectAccessesRead/when_the_team_access_exists
=== RUN   TestTeamProjectAccessesRead/when_the_team_access_exists/team_relationship_is_decoded
=== RUN   TestTeamProjectAccessesRead/when_the_team_access_exists/project_relationship_is_decoded
=== RUN   TestTeamProjectAccessesRead/when_the_team_access_does_not_exist
=== RUN   TestTeamProjectAccessesRead/without_a_valid_team_access_ID
--- PASS: TestTeamProjectAccessesRead (3.01s)
    --- PASS: TestTeamProjectAccessesRead/when_the_team_access_exists (0.24s)
        --- PASS: TestTeamProjectAccessesRead/when_the_team_access_exists/team_relationship_is_decoded (0.00s)
        --- PASS: TestTeamProjectAccessesRead/when_the_team_access_exists/project_relationship_is_decoded (0.00s)
    --- PASS: TestTeamProjectAccessesRead/when_the_team_access_does_not_exist (0.32s)
    --- PASS: TestTeamProjectAccessesRead/without_a_valid_team_access_ID (0.00s)
=== RUN   TestTeamProjectAccessesAdd
Connecting to https://tfcdev-f0bcf9e5.ngrok.io/api/v2/=== RUN   TestTeamProjectAccessesAdd/with_valid_options
=== RUN   TestTeamProjectAccessesAdd/when_the_team_already_has_access_to_the_project
=== RUN   TestTeamProjectAccessesAdd/when_options_is_missing_access
=== RUN   TestTeamProjectAccessesAdd/when_options_is_missing_team
=== RUN   TestTeamProjectAccessesAdd/when_options_is_missing_project
--- PASS: TestTeamProjectAccessesAdd (4.20s)
    --- PASS: TestTeamProjectAccessesAdd/with_valid_options (0.74s)
    --- PASS: TestTeamProjectAccessesAdd/when_the_team_already_has_access_to_the_project (1.45s)
    --- PASS: TestTeamProjectAccessesAdd/when_options_is_missing_access (0.00s)
    --- PASS: TestTeamProjectAccessesAdd/when_options_is_missing_team (0.00s)
    --- PASS: TestTeamProjectAccessesAdd/when_options_is_missing_project (0.00s)
=== RUN   TestTeamProjectAccessesUpdate
Connecting to https://tfcdev-f0bcf9e5.ngrok.io/api/v2/=== RUN   TestTeamProjectAccessesUpdate/with_valid_attributes
--- PASS: TestTeamProjectAccessesUpdate (2.71s)
    --- PASS: TestTeamProjectAccessesUpdate/with_valid_attributes (0.27s)
=== RUN   TestTeamProjectAccessesRemove
Connecting to https://tfcdev-f0bcf9e5.ngrok.io/api/v2/=== RUN   TestTeamProjectAccessesRemove/with_valid_options
=== RUN   TestTeamProjectAccessesRemove/when_the_team_access_does_not_exist
=== RUN   TestTeamProjectAccessesRemove/when_the_team_access_ID_is_invalid
--- PASS: TestTeamProjectAccessesRemove (3.05s)
    --- PASS: TestTeamProjectAccessesRemove/with_valid_options (0.46s)
    --- PASS: TestTeamProjectAccessesRemove/when_the_team_access_does_not_exist (0.18s)
    --- PASS: TestTeamProjectAccessesRemove/when_the_team_access_ID_is_invalid (0.00s)
PASS
ok  	github.com/hashicorp/go-tfe	24.236s
?   	github.com/hashicorp/go-tfe/examples/organizations	[no test files]
?   	github.com/hashicorp/go-tfe/examples/workspaces	[no test files]
?   	github.com/hashicorp/go-tfe/mocks	[no test files]

Approved once the other suggestions have been made ✨

@hs26gill hs26gill force-pushed the hs26gill/add-team-project-permissions branch 2 times, most recently from 996ded7 to c61a6e5 Compare January 3, 2023 22:53
@hs26gill hs26gill requested a review from brandonc January 4, 2023 20:00
brandonc
brandonc previously approved these changes Jan 5, 2023
Copy link
Collaborator

@brandonc brandonc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good. I smoke tested adding/deleting/listing and found everything working as advertised.

@hs26gill hs26gill force-pushed the hs26gill/add-team-project-permissions branch from c61a6e5 to e1256f5 Compare January 5, 2023 19:52
@hs26gill hs26gill force-pushed the hs26gill/add-team-project-permissions branch from e1256f5 to 8c24c5c Compare January 5, 2023 20:00
brandonc
brandonc previously approved these changes Jan 5, 2023
Copy link
Collaborator

@brandonc brandonc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏆

@hs26gill hs26gill merged commit bf5971d into main Jan 5, 2023
@hs26gill hs26gill deleted the hs26gill/add-team-project-permissions branch January 5, 2023 21:34
@github-actions
Copy link

github-actions bot commented Jan 5, 2023

Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants